﻿using System;
using Newtonsoft.Json;

namespace AutoR.Helpers
{
	// Token: 0x02000243 RID: 579
	public class DateTimeConverter : JsonConverter
	{
		// Token: 0x06000D78 RID: 3448 RVA: 0x00073AE6 File Offset: 0x00071CE6
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			writer.WriteValue(((bool)value) ? 1 : 0);
		}

		// Token: 0x06000D79 RID: 3449 RVA: 0x00073B38 File Offset: 0x00071D38
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			try
			{
				DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
				dateTime = dateTime.AddSeconds(Convert.ToDouble(reader.Value));
				return dateTime.ToLocalTime();
			}
			catch (Exception)
			{
			}
			return null;
		}

		// Token: 0x06000D7A RID: 3450 RVA: 0x00073B90 File Offset: 0x00071D90
		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(int);
		}
	}
}
